From 776c9c74808e65e7bf023f0438c6386c8ec52677 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 25 Jun 2004 04:33:25 +0000 Subject: [PATCH] Commit a forgotten fix. --- ChangeLog | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtktreestore.c | 35 +++++++++++++++++++++++++---------- 5 files changed, 45 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 39fba44898..018a02d18d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Jun 25 00:32:15 2004 Matthias Clasen + + * gtk/gtktreestore.c (gtk_tree_store_swap): Commit the change + which was mentioned below. + Thu Jun 24 23:35:09 2004 Matthias Clasen * gtk/gtknotebook.c (gtk_notebook_class_init): Fix a typo, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 39fba44898..018a02d18d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Fri Jun 25 00:32:15 2004 Matthias Clasen + + * gtk/gtktreestore.c (gtk_tree_store_swap): Commit the change + which was mentioned below. + Thu Jun 24 23:35:09 2004 Matthias Clasen * gtk/gtknotebook.c (gtk_notebook_class_init): Fix a typo, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 39fba44898..018a02d18d 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Fri Jun 25 00:32:15 2004 Matthias Clasen + + * gtk/gtktreestore.c (gtk_tree_store_swap): Commit the change + which was mentioned below. + Thu Jun 24 23:35:09 2004 Matthias Clasen * gtk/gtknotebook.c (gtk_notebook_class_init): Fix a typo, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 39fba44898..018a02d18d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Fri Jun 25 00:32:15 2004 Matthias Clasen + + * gtk/gtktreestore.c (gtk_tree_store_swap): Commit the change + which was mentioned below. + Thu Jun 24 23:35:09 2004 Matthias Clasen * gtk/gtknotebook.c (gtk_notebook_class_init): Fix a typo, diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c index 6f7bf8c84a..8d18427394 100644 --- a/gtk/gtktreestore.c +++ b/gtk/gtktreestore.c @@ -2014,18 +2014,33 @@ gtk_tree_store_swap (GtkTreeStore *tree_store, gtk_tree_path_up (path_a); gtk_tree_path_up (path_b); - if (gtk_tree_path_compare (path_a, path_b)) + if (gtk_tree_path_get_depth (path_a) == 0 + || gtk_tree_path_get_depth (path_b) == 0) { - gtk_tree_path_free (path_a); - gtk_tree_path_free (path_b); - - g_warning ("Given childs are not in the same level\n"); - return; + if (gtk_tree_path_get_depth (path_a) != gtk_tree_path_get_depth (path_b)) + { + gtk_tree_path_free (path_a); + gtk_tree_path_free (path_b); + + g_warning ("Given children are not in the same level\n"); + return; + } + parent_node = G_NODE (tree_store->root); + } + else + { + if (gtk_tree_path_compare (path_a, path_b)) + { + gtk_tree_path_free (path_a); + gtk_tree_path_free (path_b); + + g_warning ("Given children don't have a common parent\n"); + return; + } + gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_store), &parent, + path_a); + parent_node = G_NODE (parent.user_data); } - - gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_store), &parent, path_a); - parent_node = G_NODE (parent.user_data); - gtk_tree_path_free (path_b); /* old links which we have to keep around */ -- 2.30.2